package org.pzy.java.concurrency;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * @Author: DRevelation
 * @Date: 2022/4/26 14:31
 */
public class ScheduledExecutorTest {


    public static void main(String[] args) {
        ScheduledExecutorService exec = Executors.newSingleThreadScheduledExecutor();

        try {
            exec.schedule(() -> {
                System.out.println("哈哈");
            }, 2, TimeUnit.SECONDS);
        } finally {
            exec.shutdown();
        }


    }
}
